Carbon


UnflattenCollection

Header: Collections.h Carbon status: Supported

Unflattens a collection that was flattened using the FlattenCollection or FlattenPartialCollection function.

OSErr UnflattenCollection (
    Collection c, 
    CollectionFlattenUPP flattenProc, 
    void *refCon
);
c

A reference to the collection object you want to create from the flattened data. The behavior of this function is undefined if you do not provide a reference to a valid collection object.

flattenProc

A pointer to a function to read in flattened data.

refCon

A reference constant that you want the Collection Manager to pass to your callback function each time it calls the callback function. You can use this parameter as a pointer to a structure containing information your callback function needs when reading the blocks of flattened data.

function result

A result code. This function can return any error returned by the callback function.

DISCUSSION

The UnflattenCollection function unflattens a stream of bytes into the collection object you specify with the c parameter.

As this function unflattens the collection, it repeatedly calls the callback function you specify using the flattenProc parameter. Each time it calls this function, it provides the callback function with a pointer to a block of memory and a requested size. The callback function is responsible for reading the next set of bytes from the flattened byte stream and copying the data into the block of memory.

The Collection Manager continues to call your callback function, requesting more of the flattened stream of bytes each time, until it has unflattened the entire collection. Your callback function can read the flattened data from any source you choose: it could read the flattened data from a handle-based block of memory, it could read the flattened data from disk, and so on.

To create a flattened collection that includes only those collection items whose attributes match a specified pattern, use the FlattenPartialCollection function.

To create a flattened collection that includes every item in a collection, use the FlattenCollection function.

AVAILABILITY

Supported in Carbon. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.


© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)